                <div class="workSpace">
                    <!-- content -->
                    <div class="wrprSale">
                        <div class="wrpSale clearfix">
                            <div class="wrprSaleItm">
                                <div class="wrpSaleItm">
                                    <div class="wrprSalePpl clBd2 bdFull">
                                        <div class="wrpSalePplHd clBg1 clBd2 bdBtm">
                                            <span class="clTxtPOSB fs02">Popular Items</span>
                                        </div>
                                        
                                        
                                        
                                           <?
                                            
                                            $classset="clBg3";
                                            if(count($data['poppular'])&&$data['poppular']){
                                            
                                            $classset='clearfix';
                                            
                                            }
                                            ?>
                                        <div class="wrpSalePplBd <?=$classset?>">
                                            <div class="contin continL">
                                                <span class="icoPOS icoContL"></span>
                                            </div>
                                            <div class="contin continR">
                                                <span class="icoPOS icoContR"></span>
                                            </div>
                                            

                                            
                                            
                                            
                                            
                                            

                                            
                                            <?if(count($data['poppular'])&&$data['poppular']){?>
                                            <div class="wrpInSalePplBd clearfix">
                                            <?
                                            foreach($data['poppular'] as $valueproduct)
                                            {
                                            $showdata='';
                                            $price=0;
                                            if(count($valueproduct['plugins']))
                                            {
                                            foreach($valueproduct['plugins'] as $valueplugins)
                                            {
                                            if($valueplugins['plugid']=='6')
                                            {
                                            $price=$valueplugins['price'];
                                            if($valueplugins['saleprice']!='0.00')
                                            {
                                            $price=$valueplugins['saleprice'];
                                            
                                            }
                                            
                                            $showdata=$valueplugins['show'];
                                            
                                            }
                                            
                                            
                                            }
                                            
                                            
                                            
                                            
                                            }
                                            
                                            ?>
                                            
                                                <div class="saleItm" onclick="calculateorder(<?=$valueproduct['productid']?>,'<?=$valueproduct['simg']['newpath']?>','<?=mysql_real_escape_string($valueproduct['title'])?>',<?=$price?>,0,0)">
                                                    <img src="<?=$valueproduct['simg']['newpath']?>" alt="img">
                                                    <div class="wrpInfSaleItm">
                                                        <div class="infSaleItm">
                                                            <div class="prcSaleItm">
                                                                <span class="clTxtPOSW fs02"><?=$showdata?></span>
                                                            </div>
                                                            <div class="ttlSaleItm">
                                                                <span class="clTxtPOSW fs02"><?=$valueproduct['title']?></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                              </div> 
                                            <?
                                            }
                                             ?>
                                            </div>
                                            
                                            <?}else{?>

                                            <div class="noPOSData noPplPOS">
                                                <span class="fs05">No popular items.</span>
                                                <span class="fs02">You can add popular products in this popular box by adding #popular in tag field of the product.</span>
                                            </div>
                                            
                                            
                                            <?}?>
                                            
                                            
                                            
                                            
                                            
                                         
                                            
                                        </div>
                                    </div>
                                    <div class="wrprSalePd clBd2 bdFull">
                                        <div class="wrpSalePdHd clBg1 clBd2 bdBtm">
                                            <div class="wrprSalePdTag">
                                                <div class="wrpOutSalePdTag clearfix">
                                                
                                                
                                                
                                            <?if(count($data['tagordersystem'])&&$data['tagordersystem']){
                                                
                                                foreach($data['tagordersystem'] as $valuetagorder)
                                                {
                                                ?>
                                            
                                            
                                            <div class="pdTag clBg1 tagTg">
                                                        <div class="pdInTag" onclick="tagsearchdata(<?=$valuetagorder['tagid']?>)">
                                                            <span class="clTxtPOSB fs05 txtTag" ><?=$valuetagorder['name']?></span>
                                                        </div>
                                            </div> 
                                            
                                            
                                            <?
                                                }
                                            }else{?>
                                            
                                            <div class="noPOSData noTagPOS">
                                                        <span class="fs05">No tags.</span>
                                                    </div>
                                            
                                            <?}?>
   

                                                </div>
                                            </div>
                                            <div class="wrprSalePdSrch">
                                                <div class="wrpSalePdSrch">
                                                    <input class="inpPdSrch clBg4 fs07 clTxt3" id="textsearchproductstring" type="text" placeholder="Search">
                                                    <div class="btnPdSrch clBg3" onclick="textsearchalldata()">
                                                        <span class="icoPOS icoSrch"></span>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="wrpSalePdBd clBg3">
                                            <div class="contin continT">
                                                <span class="icoPOS icoContT"></span>
                                            </div>
                                            <div class="contin continD">
                                                <span class="icoPOS icoContD"></span>
                                            </div>
                                            <div class="wrpInSalePdBd clearfix">
                                            <?if(count($data['product'])&&$data['product']){
                                            
                                            foreach($data['product'] as $valueproduct)
                                            {
                                            $showdata='';
                                            $price=0;
                                            if(count($valueproduct['plugins']))
                                            {
                                            foreach($valueproduct['plugins'] as $valueplugins)
                                            {
                                            if($valueplugins['plugid']=='6')
                                            {
                                            $price=$valueplugins['price'];
                                            if($valueplugins['saleprice']!='0.00')
                                            {
                                            $price=$valueplugins['saleprice'];
                                            
                                            }
                                            
                                            $showdata=$valueplugins['show'];
                                            
                                            }
                                            
                                            
                                            }
                                            
                                            
                                            
                                            
                                            }
                                            
                                            ?>
                                            
                                                <div class="saleItm productisdata-<?=$valueproduct['productid']?> tagalldataset<?
                                                if(count($valueproduct['tag']))
                                                {
                                                foreach($valueproduct['tag'] as $valuetagdata)
                                                {
                                                
                                                echo ' tagdataset-'.$valuetagdata['tagid'].'';
                                                
                                                }
                                                
                                                
                                                }
                                                
                                                
                                                
                                                
                                                
                                                
                                                ?>" onclick="calculateorder(<?=$valueproduct['productid']?>,'<?=$valueproduct['simg']['newpath']?>','<?=mysql_real_escape_string($valueproduct['title'])?>',<?=$price?>,0,0)">
                                                    <img src="<?=$valueproduct['simg']['newpath']?>" alt="img">
                                                    <div class="wrpInfSaleItm">
                                                        <div class="infSaleItm">
                                                            <div class="prcSaleItm">
                                                                <span class="clTxtPOSW fs02"><?=$showdata?></span>
                                                            </div>
                                                            <div class="ttlSaleItm">
                                                                <span class="clTxtPOSW fs02"><?=$valueproduct['title']?></span>
                                                            </div>
                                                        </div>
                                                    </div>
                                              </div> 
                                            <?
                                            }
                                            
                                            }else{?>  
                                              
                                              <div class="wrpInSalePdBd clearfix">
                                                <div class="noPOSData noPdPOS">
                                                    <span class="icoPOS icoNoPd"></span>
                                                    <span class="fs05">No product items.</span>
                                                    <span class="fs02">Please add products in product feature of DMConnex or <a href="">click here</a>.</span>
                                                </div>
                                            </div>
                                            
                                            <?}?>

                                            </div>
                                        </div>
                                    </div>
                                    <div class="wrpPmtSpc clearfix">
                                        <div class="wrprSalePmt clBd2 bdFull">
                                            <div class="wrpSalePmtHd clBg1 clBd2 bdBtm clearfix">
                                                <div class="wrpTxtPmt">
                                                    <span class="clTxtPOSB fs02">Promotion</span>
                                                </div>
                                                <div class="wrpCodePmt clearfix">
                                                    <input type="text" class="inpCodePmt clBg4 clTxt3 fs02" placeholder="Enter Coupon Code">
                                                    <button class="btnPOSB btnCodePmt fs02" onclick="checkcodepromotion()">SUBMIT</button>
                                                </div>
                                            </div>
                                            
                                             <?
                                                                                                
                                                                                                $classset="clBg3";
                                                                                                if(count($data['promotion'])&&$data['promotion']){
                                                                                                $classset="clearfix";
                                                                                                
                                                                                                }?>
                                            <div class="wrpSalePmtBd <?=$classset?>">
                                                <div class="contin continL">
                                                    <span class="icoPOS icoContL"></span>
                                                </div>
                                                <div class="contin continR">
                                                    <span class="icoPOS icoContR"></span>
                                                </div>
                                                                                               

                                                
                                                <?if(count($data['promotion'])&&$data['promotion']){
                                                
                                                
                                                
                                                
                                                ?>
                                                
                                                                                                <div class="wrpInSalePmtBd <?=$classset?>">
                                             
                                                  <?
                                                  
                                                foreach($data['promotion'] as $valueproduct)
                                            {
                                            $showdata='';
                                            $price=0;
                                            if(count($valueproduct['plugins']))
                                            {
                                            foreach($valueproduct['plugins'] as $valueplugins)
                                            {
                                            if($valueplugins['plugid']=='24')
                                            {
                                          
                                            $price=$valueplugins['price'];
                                            
                                            }
                                            
                                            
                                            }
                                            
                                            
                                            
                                            
                                            }
                                                  
                                                  ?>
                                                  <div class="saleItm" onclick="calculateorder(<?=$valueproduct['productid']?>,'<?=$valueproduct['simg']['newpath']?>','<?=mysql_real_escape_string($valueproduct['title'])?>',0,<?=$price?>,0)" >
                                                        <img src="<?=$valueproduct['simg']['newpath']?>" alt="img">
                                                        <div class="wrpInfSaleItm">
                                                            <div class="infSaleItm">
                                                                <div class="prcSaleItm">
                                                                    <span class="clTxtPOSW fs02">-<?=$price?> Baht</span>
                                                                </div>
                                                                <div class="ttlSaleItm">
                                                                    <span class="clTxtPOSW fs02"><?=$valueproduct['title']?></span>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    
                                            <?}?>
                                                  
                                             
                                               </div>
                                               <?}else{?>
                                               <div class="noPOSData noPmtPOS">
                                                    <span class="fs05">No promotion items.</span>
                                                    <span class="fs02">Please add promotions in promotion feature of DMConnex or <a href="">click here</a>.</span>
                                                </div>
                                               
                                               <?}?>
                                               
                                                
                                            </div>
                                        </div>
                                        <div class="wrprSaleSpc clBd2 bdFull">
                                            <div class="wrpSaleSpcHd clBg1 clBd2 bdBtm clearfix">
                                                <div class="wrpTxtSpc">
                                                    <span class="clTxtPOSB fs02">Special</span>
                                                </div>
                                            </div>
                                            <div class="wrpSaleSpcBd clBg3">
                                                <div class="wrpInSaleSpcBd" onclick="opencreditpopup()">
                                                    <span class="icoPOS icoSpc"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="wrprSaleCart clBg3">
                                <div class="wrpSaleCart">
                                    <div class="wrprSaleCtm clBd2 bdBtm clearfix">
                                        <div class="wrpSaleCtm" onclick="openpopupmember()">
                                        
                                            <?if($data['userorder']){?>
                                            <img src="/img/user1.jpg" alt="img">
                                            
                                            <div class="wrpCtmName">
                                                <div class="wrpInCtmName">
                                                    <div class="ctmName">
                                                        <span class="clTxtPOSB fs05 cutTxt"><?=$data['userorder']['displayname']?></span>
                                                    </div>
                                                    <div class="ctmCred">
                                                        <span class="clTxtPOSB fs02"><?=$data['userorder']['credit']?> Credit</span>
                                                    </div>
                                                  <!--  <div class="ctmRoute clearfix">
                                                        <span class="icoPOS icoCtmRoute icoCtmRoute10"></span>
                                                        <span class="lctRoute clTxtPOSB cutTxt fs02">Lad Phrao - Huai Whwang</span>
                                                    </div>-->
                                                </div>
                                            </div>
                                            
                                            <?}else{?>
                                            <img src="/img/dfthmbuser.jpg" alt="img">
                                            <div class="wrpCtmName">
                                                <div class="wrpInCtmName">
                                                    <div class="ctmName">
                                                        <span class="clTxtPOSB fs05 cutTxt">Guest</span>
                                                    </div>
                                                </div>
                                            </div>
                                            
                                            
                                            <?}?>
                                            
                                            
                                            
                                                                                    </div>
                                                                                    
                                                           <?if(!$data['userorder']){?>
                                                           
                                                          <div class="wrpRgtCtm">
                                            <button onclick="openregisteruser()" class="btnPOSW btnRgt fs05">REGISTER</button>
                                        </div> 
                                                           <?}?>                         
                                                                                    
                                    </div>
                                    <div class="wrprSalePrc clBd2 bdBtm">
                                        <div class="totalPrice clBg5 clBd2 bdFull clearfix">
                                            <span class="spnSaleTotal clTxtPOSB fs05">Total</span>
                                            <span class="spnSalePrc clTxtPOSB fs11"><?if($data['userpriceall']){ echo $data['userpriceall'];}else{ echo '0';}?> Baht</span>
                                        </div>
                                        <div class="tender clearfix">
                                            <span class="tenderTxt clTxtPOSB fs05">Cash<em>(Baht)</em></span>
                                            <input type="text" value="<?if($data['userpricecash']){ echo $data['userpricecash'];}else{ echo '';}?>" class="tenderInp clBg4 clTxt3 fs04" readonly>
                                        </div>
                                        <div class="change clearfix">
                                            <span class="changeTxt clTxtPOSB fs05">Change<em>(Baht)</em></span>
                                            <span class="changeCost clTxt3 fs11"><?if($data['userpricechange']){ echo $data['userpricechange'];}else{ echo '0';}?></span>                                            
                                        </div>
                                        <div class="btnOrdChk clearfix">
                                            <div class="btnOutOrd">
                                                <button onclick="saveorderalldata(1)" class="btnPOSC btnOrd fs07">ORDER</button>
                                            </div>
                                            <div class="btnOutChk">
                                                <button onclick="saveorderalldata(2)" class="btnPOSB btnCheck fs07">CHECK OUT</button>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="wrprSaleLst">
                                        <div class="hdSaleLst clBg1 clBd2 bdBtm clearfix">
                                            <span class="hdSaleItmLst fs02 clTxtPOSB">Item List</span>
                                            <span class="hdSaleTtLst fs02 clTxtPOSB">Total Item : <?if(count($data['orderlist'])&&$data['orderlist']){ echo count($data['orderlist']);}else{echo '0';}?></span>
                                        </div>
                                        <div class="wrpOutSaleLst">
                                            <div class="wrpInSaleLst">
                                                <div class="contin continT">
                                                    <span class="icoPOS icoContT"></span>
                                                </div>
                                                <div class="contin continD">
                                                    <span class="icoPOS icoContD"></span>
                                                </div>
                                                <div class="wrpSaleLst">
                                                
                                                <?if(count($data['orderlist'])&&$data['orderlist']){?>
                                                
                                                    <div class="wrpInnSaleLst">
                                             
                                                    </div>
                                                    
                                                    
                                                    <?}else{?>
                                                    
                                                    
                                                    <div class="noPOSData noLstPOS">
                                                        <span class="icoPOS icoNoSaleLst"></span>
                                                        <span class="fs05">No sales items.</span>
                                                        <span class="fs02">Please select product or promotion.</span>
                                                    </div>
                                                    
                                                    <?}?>
                                                    
                                                    
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
